
package com.limoilux.cobolux.ui.text;

import org.eclipse.jface.text.rules.EndOfLineRule;
import org.eclipse.jface.text.rules.ICharacterScanner;
import org.eclipse.jface.text.rules.IToken;

public class CobolCommentRule extends EndOfLineRule
{
	private static final int LAST_COMMENT_LINE = 7;

	public CobolCommentRule(IToken token)
	{
		super("*", token, '*', false);
	}

	@Override
	protected boolean sequenceDetected(ICharacterScanner scanner, char[] sequence, boolean eofAllowed)
	{
		boolean goodColumn = scanner.getColumn() <= CobolCommentRule.LAST_COMMENT_LINE;
		return goodColumn && super.sequenceDetected(scanner, sequence, eofAllowed);
	}

}
